package cn.xz.hfsk.util

import android.widget.Toast
import cn.xz.hfsk.base.BaseApplication

object ToastUtil {

    private var sToast: Toast? = null

    fun show(s: String) {
        try {
            if (sToast != null) {
                sToast!!.cancel()
                sToast = null
            }
            // 解决 MIUI 会显示应用名称问题
            sToast = Toast.makeText(BaseApplication.getContext(), "", Toast.LENGTH_SHORT)
            sToast?.setText(s)
            sToast?.show()
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

}